<template>
    <div>
             <div id="slider" class="mui-slider">
				<div id="sliderSegmentedControl" class="mui-scroll-wrapper mui-slider-indicator mui-segmented-control mui-segmented-control-inverted">
					<div class="mui-scroll">
						<a :class="['mui-control-item', item.id==0?'mui-active':'']" v-for="item in photolist" :key="item.id">
							{{item.title}}
						</a>
						
					</div>
				</div>
			</div> 
            <ul class="photo-conter">
       <router-link :to="'/home/photolist/'+item.id" v-for="item in photo" :key="item.id" tag="li"> 
    <img v-lazy="item.img_url">
	<div class="photo-info">
	<div class="title"><h3>{{item.title}}</h3></div>
	<div class="info"><p>{{item.zhaiyao}}</p></div>
	</div>
       </router-link>
</ul>

        </div>
</template>
<script>
import mui from '../../lib/mui/js/mui.min.js';
import {Toast} from 'mint-ui'
export default{
    data(){
        return{
		 photolist:[],
		 photo:[]
		}
	},
	created(){
		this.getpost();
		this.getphoto();
	},
    mounted(){
mui('.mui-scroll-wrapper').scroll({
	deceleration: 0.0005 //flick 减速系数，系数越大，滚动速度越慢，滚动距离越小，默认值0.0006
});
	},
	
    methods:{
       getpost(){
		   this.$http.get("../../data/dataphoto.json").then(result=>{
			   if(result.body.status===0){
				   result.body.message.unshift({"id":0,"title":"全部"})
					this.photolist = result.body.message
					console.log(this.photolist);
			   }else{
				   Toast("获取失败");
			   }
		   })
	   },
	   getphoto(){
		   this.$http.get("../../data/photo.json").then(result=>{
			   if(result.body.status===0){
				   console.log(result.body.message);
					 this.photo=result.body.message;
					
			   }
		   })
	   }
    }
}
</script>
<style lang="sass" scoped>
* {
    touch-action: none;
} 
.photo-conter{
	list-style: none;
	margin-bottom:0px;
	padding:8px;
	li{
        background:#ccc;
		text-align:center;
		margin-bottom:10px;
		box-shadow:0 0 6px #999;
		position:relative;
		img{
			width:100%;
	        vertical-align:middle;
		}
		.photo-info{
			width:100%;
			position:absolute;
			bottom:0px;
			background:rgba(0,0,0,.4);
			text-align:left;
			max-height:60px;
			.title{
				h3{
				font-size:14px;
				color:#fff;
			}
			}
			.info{
				p{
				font-size:12px;
				color:#fff;
				}
			}
		}
	}
}
</style>
